﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Engine.SceneControl.HUD;
using TomShane.Neoforce.Controls;
using Engine.MessageSystem;
using Etapa1.Screens;
using Microsoft.Xna.Framework;

namespace Etapa1.HudSample
{
    public class HudSample : SimpleHud
    {
        private Window _window;
        private Button _button;
        private ImageBox _image;
        int handler;
        public HudSample(int Camerahandler)
        {
            this.handler = Camerahandler;
        }

        public override void Initialize(Engine.EngineStuff es , IWindowManager man)
        {
            base.Initialize(es, man);

            Manager manager = man.getManager() as Manager;
           

            _window =  HudManager.AddWindow("main", "Custom TollTips", 200, 480);
            
            _button = HudManager.AddButton("button01", "Standard", 72, 24,new Vector2((_window.ClientWidth / 2) - 36,_window.ClientHeight - 16), "main");

            _button.Anchor = Anchors.Bottom;

            _image = HudManager.AddImageBox("imagem1", "..\\Content\\Textures\\texture", 200, 200,Vector2.Zero, null, SizeMode.Stretched);
            

            HudManager.setAction(_button, WindowManager.Action.CLICK,
                new TomShane.Neoforce.Controls.EventHandler(button_Click));
            
            _button.ToolTip.Text = "This is standard tooltip.";


            HudManager.AddTextBox("text1", ">>> Type your custom tooltip message here. <<<",20,300,32,32,"main");


          


            base.Initialize(es,man);
        }

        public void button_Click(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            this._window.Visible = false;
            MessageDeliver.SendMessage(new  Engine.MessageSystem.Message(getId(),handler,null, Priority.VERYLOW,0, MessageType.SYSTEM,true,CameraPrimeiraPessoaHandler.TURNONMOUSE));
        }

        public override void HandleMessage(Engine.MessageSystem.Message mes)
        {

            if (mes.Cod == "VISIBLE")
            {
                this._window.Visible = true;
                MessageDeliver.SendMessage(new Engine.MessageSystem.Message(getId(), handler, null, Priority.VERYLOW, 0, MessageType.SYSTEM, false, CameraPrimeiraPessoaHandler.TURNONMOUSE));
            }
            else if (mes.Cod == "INVISIBLE")
            {
                this._window.Visible = false;
                MessageDeliver.SendMessage(new Engine.MessageSystem.Message(getId(), handler, null, Priority.VERYLOW, 0, MessageType.SYSTEM, true, CameraPrimeiraPessoaHandler.TURNONMOUSE));
            }
        }
    }
}







